package com.numberone.master.modules.agent.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.numberone.master.common.persistence.TreeEntity;

/**
 * 代理商Entity
 * @author chengkang
 * @version 2018-01-23
 */
public class Agent extends TreeEntity<Agent> {
	
	private static final long serialVersionUID = 1L;
	private Agent parent;		// 上级id
	private String name;		// 姓名
	private String busslince;		// busslince
	private String bussregno;		// bussregno
	private String bussregaddress;		// 地址
	private Date expirytime;		// 到期时间
	private String artificialper;		// 联络人
	private String artificialphone;		// 人工电话
	private String artificialmail;		// 邮件
	private String contacts;		// 联络
	private String contactsphone;		// 联络电话
	private String contactsmail;		// 联系人邮件
	private Long userid;		// 所属用户id
	private Date createtime;		// 录入时间
	private Long state;		// 状态
	private String cardimg;		// 卡图片
	private String txFee;		// 费用
	private String acctNo;		// 银行卡号
	private String acctName;		// 卡姓名
	private String bankNo;		// 行号
	private String optDate;		// 变更审核人
	private String optTime;		// 变更时间
	private String optUserId;		// 变更人id

	public Agent() {
		super();
	}

	public Agent(String id){
		super(id);
	}

	@JsonBackReference
	public Agent getParent() {
		return parent;
	}

	public void setParent(Agent parent) {
		this.parent = parent;
	}
	
	@Length(min=0, max=128, message="姓名长度必须介于 0 和 128 之间")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@Length(min=0, max=256, message="busslince长度必须介于 0 和 256 之间")
	public String getBusslince() {
		return busslince;
	}

	public void setBusslince(String busslince) {
		this.busslince = busslince;
	}
	
	@Length(min=0, max=48, message="bussregno长度必须介于 0 和 48 之间")
	public String getBussregno() {
		return bussregno;
	}

	public void setBussregno(String bussregno) {
		this.bussregno = bussregno;
	}
	
	@Length(min=0, max=256, message="地址长度必须介于 0 和 256 之间")
	public String getBussregaddress() {
		return bussregaddress;
	}

	public void setBussregaddress(String bussregaddress) {
		this.bussregaddress = bussregaddress;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getExpirytime() {
		return expirytime;
	}

	public void setExpirytime(Date expirytime) {
		this.expirytime = expirytime;
	}
	
	@Length(min=0, max=128, message="联络人长度必须介于 0 和 128 之间")
	public String getArtificialper() {
		return artificialper;
	}

	public void setArtificialper(String artificialper) {
		this.artificialper = artificialper;
	}
	
	@Length(min=0, max=24, message="人工电话长度必须介于 0 和 24 之间")
	public String getArtificialphone() {
		return artificialphone;
	}

	public void setArtificialphone(String artificialphone) {
		this.artificialphone = artificialphone;
	}
	
	@Length(min=0, max=56, message="邮件长度必须介于 0 和 56 之间")
	public String getArtificialmail() {
		return artificialmail;
	}

	public void setArtificialmail(String artificialmail) {
		this.artificialmail = artificialmail;
	}
	
	@Length(min=0, max=48, message="联络长度必须介于 0 和 48 之间")
	public String getContacts() {
		return contacts;
	}

	public void setContacts(String contacts) {
		this.contacts = contacts;
	}
	
	@Length(min=0, max=24, message="联络电话长度必须介于 0 和 24 之间")
	public String getContactsphone() {
		return contactsphone;
	}

	public void setContactsphone(String contactsphone) {
		this.contactsphone = contactsphone;
	}
	
	@Length(min=0, max=48, message="联系人邮件长度必须介于 0 和 48 之间")
	public String getContactsmail() {
		return contactsmail;
	}

	public void setContactsmail(String contactsmail) {
		this.contactsmail = contactsmail;
	}
	
	public Long getUserid() {
		return userid;
	}

	public void setUserid(Long userid) {
		this.userid = userid;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}
	
	public Long getState() {
		return state;
	}

	public void setState(Long state) {
		this.state = state;
	}
	
	@Length(min=0, max=256, message="卡图片长度必须介于 0 和 256 之间")
	public String getCardimg() {
		return cardimg;
	}

	public void setCardimg(String cardimg) {
		this.cardimg = cardimg;
	}
	
	@Length(min=0, max=255, message="费用长度必须介于 0 和 255 之间")
	public String getTxFee() {
		return txFee;
	}

	public void setTxFee(String txFee) {
		this.txFee = txFee;
	}
	
	@Length(min=0, max=255, message="银行卡号长度必须介于 0 和 255 之间")
	public String getAcctNo() {
		return acctNo;
	}

	public void setAcctNo(String acctNo) {
		this.acctNo = acctNo;
	}
	
	@Length(min=0, max=255, message="卡姓名长度必须介于 0 和 255 之间")
	public String getAcctName() {
		return acctName;
	}

	public void setAcctName(String acctName) {
		this.acctName = acctName;
	}
	
	@Length(min=0, max=255, message="行号长度必须介于 0 和 255 之间")
	public String getBankNo() {
		return bankNo;
	}

	public void setBankNo(String bankNo) {
		this.bankNo = bankNo;
	}
	
	@Length(min=0, max=8, message="变更审核人长度必须介于 0 和 8 之间")
	public String getOptDate() {
		return optDate;
	}

	public void setOptDate(String optDate) {
		this.optDate = optDate;
	}
	
	@Length(min=0, max=6, message="变更时间长度必须介于 0 和 6 之间")
	public String getOptTime() {
		return optTime;
	}

	public void setOptTime(String optTime) {
		this.optTime = optTime;
	}
	
	@Length(min=0, max=255, message="变更人id长度必须介于 0 和 255 之间")
	public String getOptUserId() {
		return optUserId;
	}

	public void setOptUserId(String optUserId) {
		this.optUserId = optUserId;
	}

	public String getParentId() {
		return parent != null && parent.getId() != null ? parent.getId() : "0";
	}
}